package openbang.account.web.portal.widget;


import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.user.client.Window;


/**
 * 延迟加载的控制  GWT.runAsync
 * 
 * 思路：client包为入口类
 *      widget 包为组件类（含界面显示控制以及与后台的交互）
 *      
 *  该Controller利用 GWT.runAsync 实现延迟加载每一个 widget 组件
 *  
 *  约束：组件之间不要相互调用（如：收件箱里发邮件，使用自己的发邮件实例），组件也不能控制 抽屉和TabPanel
 *  
 * @author aibo zeng
 *
 */

public class LazyLoading implements RunAsyncCallback{
	public String something = null;
	public LazyLoading(String something){
		this.something = something;
	}

	@Override
	public void onFailure(Throwable reason) {
        Window.alert("lazy loading error.");
	}

	@Override
	public void onSuccess() {
	}
	
/*	
	public static void asyncOnInitUserInfo(){
		GWT.runAsync(new RunAsyncCallback(){
		    public void onFailure(Throwable caught) {
		    }
		    public void onSuccess() {
		    	cc = new UserBaseInfoMaintainWidget();
		    }
		});		
	}
	public static void asyncOnInitSendMsg(){
		GWT.runAsync(new RunAsyncCallback(){
		    public void onFailure(Throwable caught) {
		        Window.alert("lazy loading error.");
		    }
		    public void onSuccess() {
		    	cc = new SendMsgWidget();
		    }
		});		
	}	
	public static void asyncOnInitMsgList(){
		GWT.runAsync(new RunAsyncCallback(){
		    public void onFailure(Throwable caught) {
		        Window.alert("lazy loading error.");
		    }
		    public void onSuccess() {
		    	cc = new MsgListWidget();
		    }
		});		
	}	
	public static void asyncOnInitMsgArchiveList(){
		GWT.runAsync(new RunAsyncCallback(){
		    public void onFailure(Throwable caught) {
		        Window.alert("lazy loading error.");
		    }
		    public void onSuccess() {
		    	cc = new MsgListWidget(MsgStatusEnum.HAS_ARCHIVE.getCode());
		    }
		});		
	}	
*/}
